﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BUS;
using Telerik.Web.UI;


public partial class admin_UserAccounts : System.Web.UI.Page
{
    protected AccountsBUS accountBUS = new AccountsBUS();
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["adminName"] == null)
            Response.Redirect("login.aspx?turn=useraccounts.aspx");
        grvAccounts.DataSource = accountBUS.GetAllAccountsList();
        
    }

    protected void grvAccounts_OnDeleteCommand(object sender, GridCommandEventArgs e)
    {
        GridDataItem dataItem = (GridDataItem)e.Item;
        string id = dataItem.GetDataKeyValue("UserName").ToString();
        accountBUS.DeleteAccount(id);
        grvAccounts.DataSource = accountBUS.GetAllAccountsList();
    }
}
